class_name 天谕Operation extends Node

var operationManager:OperationManager
var big:Big

func init(om:OperationManager):
	self.operationManager = om
	return self

func preparation_天谕_明魂搜根():
	operationManager.arr_listeningPoints.clear()
	var point = operationManager.selectedPoint
	var arrAroundPoints = GameUtils.getArrPointsHasView()
	for p in arrAroundPoints:
		if p.is_view:
			if p.small != null:
				continue
			if p.big != null && p.big.player.is_me:
				continue
		operationManager.arr_listeningPoints.append(p)
	GameUtils.neatAnimation()
	big = point.big
	big.detailHide()

func preparation_天谕_神兵天降():
	operationManager.arr_listeningPoints.clear()
	var point = operationManager.selectedPoint
	var arrAroundPoints = GameUtils.getArrPointsHasView()
	for p in arrAroundPoints:
		if p.is_view:
			if [1,2,5].has(p.real_terrain):
				continue
			if p.small != null:
				continue
			if p.big != null:
				if p.big.player.is_me:
					continue
				if !p.big.arr_states.has(BigStateType.HIDE):
					continue
		operationManager.arr_listeningPoints.append(p)
	GameUtils.neatAnimation()
	big = point.big
	big.detailHide()


func 天谕_明魂搜根(point:Point):
	WebSocketManager.sendObj(true,"天谕_明魂搜根",{"start":big.point.id,"end":point.id})
	operationManager.cancel()

func 天谕_天眼传真(point:Point):
	WebSocketManager.sendObj(true,"天谕_天眼传真",{"start":point.id})
	ObjectManager.gameManager.ui.closeAll()
	point.big.detailHide()

func 天谕_神兵天降(point:Point):
	WebSocketManager.sendObj(true,"天谕_神兵天降",{"start":big.point.id,"end":point.id})
	operationManager.cancel()
